<!DOCTYPE html>



  


<html class="theme-next gemini use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2"/>
<meta name="theme-color" content="#222">












<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />






















<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=6.1.0" rel="stylesheet" type="text/css" />


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=6.1.0">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon.ico?v=6.1.0">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon.ico?v=6.1.0">


  <link rel="mask-icon" href="/images/logo.svg?v=6.1.0" color="#222">









<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Gemini',
    version: '6.1.0',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: false,
    fastclick: false,
    lazyload: false,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>


  




  <meta name="description" content="更新日志    2018-06-02: 创建  准备工作环境Linux系统 可以使用自己原有的Linux工作环境推荐使用Gentoo官方Livecd  使用方法如下列图示：  开通网络服务 虚拟机网络配置较为简单，LiveCD启动后即有网络，详细参考官方文档  sshd服务 启动sshd服务/etc/init.d/sshd start配置sshd服务允许密码登陆vi /etc/ssh/sshd_c">
<meta name="keywords" content="Linux,Gentoo">
<meta property="og:type" content="article">
<meta property="og:title" content="Gentoo 的安装">
<meta property="og:url" content="http://yoursite.com/gentoo-install/index.html">
<meta property="og:site_name" content="胖勇の小窝">
<meta property="og:description" content="更新日志    2018-06-02: 创建  准备工作环境Linux系统 可以使用自己原有的Linux工作环境推荐使用Gentoo官方Livecd  使用方法如下列图示：  开通网络服务 虚拟机网络配置较为简单，LiveCD启动后即有网络，详细参考官方文档  sshd服务 启动sshd服务/etc/init.d/sshd start配置sshd服务允许密码登陆vi /etc/ssh/sshd_c">
<meta property="og:locale" content="zh-Hans">
<meta property="og:image" content="http://p7b7this6.bkt.clouddn.com/18-6-2/82978522.jpg">
<meta property="og:image" content="http://p7b7this6.bkt.clouddn.com/18-6-2/518881.jpg">
<meta property="og:image" content="http://p7b7this6.bkt.clouddn.com/18-6-2/96020345.jpg">
<meta property="og:image" content="http://p7b7this6.bkt.clouddn.com/18-6-2/83910657.jpg">
<meta property="og:image" content="http://p7b7this6.bkt.clouddn.com/18-6-2/73642801.jpg">
<meta property="og:image" content="http://p7b7this6.bkt.clouddn.com/18-6-2/41447592.jpg">
<meta property="og:image" content="http://p7b7this6.bkt.clouddn.com/18-6-2/40478433.jpg">
<meta property="og:image" content="http://p7b7this6.bkt.clouddn.com/18-6-2/97976949.jpg">
<meta property="og:image" content="http://p7b7this6.bkt.clouddn.com/18-6-2/23441804.jpg">
<meta property="og:image" content="http://p7b7this6.bkt.clouddn.com/18-6-12/29231760.jpg">
<meta property="og:image" content="http://p7b7this6.bkt.clouddn.com/18-6-2/34674673.jpg">
<meta property="og:updated_time" content="2018-06-12T15:26:09.599Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Gentoo 的安装">
<meta name="twitter:description" content="更新日志    2018-06-02: 创建  准备工作环境Linux系统 可以使用自己原有的Linux工作环境推荐使用Gentoo官方Livecd  使用方法如下列图示：  开通网络服务 虚拟机网络配置较为简单，LiveCD启动后即有网络，详细参考官方文档  sshd服务 启动sshd服务/etc/init.d/sshd start配置sshd服务允许密码登陆vi /etc/ssh/sshd_c">
<meta name="twitter:image" content="http://p7b7this6.bkt.clouddn.com/18-6-2/82978522.jpg">






  <link rel="canonical" href="http://yoursite.com/gentoo-install/"/>



<script type="text/javascript" id="page.configurations">
  CONFIG.page = {
    sidebar: "",
  };
</script>

  <title>Gentoo 的安装 | 胖勇の小窝</title>
  









  <noscript>
  <style type="text/css">
    .use-motion .motion-element,
    .use-motion .brand,
    .use-motion .menu-item,
    .sidebar-inner,
    .use-motion .post-block,
    .use-motion .pagination,
    .use-motion .comments,
    .use-motion .post-header,
    .use-motion .post-body,
    .use-motion .collection-title { opacity: initial; }

    .use-motion .logo,
    .use-motion .site-title,
    .use-motion .site-subtitle {
      opacity: initial;
      top: initial;
    }

    .use-motion {
      .logo-line-before i { left: initial; }
      .logo-line-after i { right: initial; }
    }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">胖勇の小窝</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button aria-label="Toggle navigation bar">
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>




<nav class="site-nav">
  
    <ul id="menu" class="menu">
      
        
        
          
  
  <li class="menu-item menu-item-home">
    <a href="/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-home"></i> <br />首页</a>
</li>

      
        
        
          
  
  <li class="menu-item menu-item-about">
    <a href="/about/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-user"></i> <br />关于</a>
</li>

      
        
        
          
  
  <li class="menu-item menu-item-tags">
    <a href="/tags/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />标签</a>
</li>

      
        
        
          
  
  <li class="menu-item menu-item-categories">
    <a href="/categories/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-th"></i> <br />分类</a>
</li>

      
        
        
          
  
  <li class="menu-item menu-item-archives">
    <a href="/archives/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />归档</a>
</li>

      

      
      
    </ul>
  

  

  
</nav>



  



</div>
    </header>

    


    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          
            

          
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://yoursite.com/gentoo-install/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="LiuGaoyong">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="http://p7b7this6.bkt.clouddn.com/18-6-3/47273717.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="胖勇の小窝">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">Gentoo 的安装
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            
                
            

            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2018-06-02T19:58:44+08:00">2018-06-02</time>
            

            
            

            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing"><a href="/categories/Liunx运维/" itemprop="url" rel="index"><span itemprop="name">Liunx运维</span></a></span>

                
                
                  ， 
                
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing"><a href="/categories/Liunx运维/Gentoo/" itemprop="url" rel="index"><span itemprop="name">Gentoo</span></a></span>

                
                
              
            </span>
          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <font size="4" face="黑体">更新日志</font> 

<blockquote>
<p>2018-06-02: 创建</p>
</blockquote>
<h2 id="准备工作环境"><a href="#准备工作环境" class="headerlink" title="准备工作环境"></a>准备工作环境</h2><h3 id="Linux系统"><a href="#Linux系统" class="headerlink" title="Linux系统"></a>Linux系统</h3><blockquote>
<p>可以使用自己原有的Linux工作环境<br>推荐使用Gentoo官方<a href="https://www.gentoo.org/downloads/" target="_blank" rel="noopener">Livecd</a><br>  使用方法如下列图示：<br><img src="http://p7b7this6.bkt.clouddn.com/18-6-2/82978522.jpg" alt=""><br><img src="http://p7b7this6.bkt.clouddn.com/18-6-2/518881.jpg" alt=""><br><img src="http://p7b7this6.bkt.clouddn.com/18-6-2/96020345.jpg" alt=""></p>
</blockquote>
<h3 id="开通网络服务"><a href="#开通网络服务" class="headerlink" title="开通网络服务"></a>开通网络服务</h3><blockquote>
<p>虚拟机网络配置较为简单，LiveCD启动后即有网络，详细参考<a href="https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Networking/zh-cn" target="_blank" rel="noopener">官方文档</a><br><img src="http://p7b7this6.bkt.clouddn.com/18-6-2/83910657.jpg" alt=""><br><a href="https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Networking/zh-cn" target="_blank" rel="noopener"></a></p>
</blockquote>
<h3 id="sshd服务"><a href="#sshd服务" class="headerlink" title="sshd服务"></a>sshd服务</h3><blockquote>
<p>启动sshd服务<code>/etc/init.d/sshd start</code><br>配置sshd服务允许密码登陆<code>vi /etc/ssh/sshd_config</code>，修改以下内容：<br><img src="http://p7b7this6.bkt.clouddn.com/18-6-2/73642801.jpg" alt=""></p>
</blockquote>
<h2 id="对安装Gentoo的磁盘进行处理"><a href="#对安装Gentoo的磁盘进行处理" class="headerlink" title="对安装Gentoo的磁盘进行处理"></a>对安装Gentoo的磁盘进行处理</h2><h3 id="默认的分区方案"><a href="#默认的分区方案" class="headerlink" title="默认的分区方案"></a>默认的分区方案</h3><p><img src="http://p7b7this6.bkt.clouddn.com/18-6-2/41447592.jpg" alt=""></p>
<h3 id="创建分区表"><a href="#创建分区表" class="headerlink" title="创建分区表"></a>创建分区表</h3><blockquote>
<p>以<code>fdisk</code>创建Linux分区表，最终结果如下图示<br><img src="http://p7b7this6.bkt.clouddn.com/18-6-2/40478433.jpg" alt=""></p>
</blockquote>
<h3 id="创建文件系统"><a href="#创建文件系统" class="headerlink" title="创建文件系统"></a>创建文件系统</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">mkfs.ext2 -T small /dev/sda2</span><br><span class="line"></span><br><span class="line">mkfs.ext4 -T small /dev/sda5</span><br><span class="line">mkfs.ext4 -T small /dev/sda6</span><br></pre></td></tr></table></figure>
<h3 id="激活swap分区"><a href="#激活swap分区" class="headerlink" title="激活swap分区"></a>激活swap分区</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">mkswap  /dev/sda3</span><br><span class="line">swapon  /dev/sda5</span><br></pre></td></tr></table></figure>
<h3 id="挂载分区"><a href="#挂载分区" class="headerlink" title="挂载分区"></a>挂载分区</h3><p><img src="http://p7b7this6.bkt.clouddn.com/18-6-2/97976949.jpg" alt=""><br><img src="http://p7b7this6.bkt.clouddn.com/18-6-2/23441804.jpg" alt=""></p>
<h2 id="安装Gentoo安装文件（stage3）"><a href="#安装Gentoo安装文件（stage3）" class="headerlink" title="安装Gentoo安装文件（stage3）"></a>安装Gentoo安装文件（stage3）</h2><h3 id="下载stage3"><a href="#下载stage3" class="headerlink" title="下载stage3"></a>下载stage3</h3><blockquote>
<p>官方下载<a href="https://www.gentoo.org/downloads/" target="_blank" rel="noopener">stage3</a><br>将其上传至LiveCD中的<code>/mnt/gentoo</code></p>
</blockquote>
<h3 id="校验其安全性（可省略），解压stage3"><a href="#校验其安全性（可省略），解压stage3" class="headerlink" title="校验其安全性（可省略），解压stage3"></a>校验其安全性（可省略），解压stage3</h3><blockquote>
<p>参考官方<a href="https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Stage/zh-cn" target="_blank" rel="noopener">文档</a><br><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> /mnt/gentoo</span><br><span class="line"></span><br><span class="line">xz -d stage3-*</span><br><span class="line">tar xvf stage3*</span><br><span class="line"></span><br><span class="line"><span class="comment"># tar xvjpf stage3-*.tar.bz2 --xattrs --numeric-owner</span></span><br></pre></td></tr></table></figure></p>
</blockquote>
<h3 id="编译配置选项"><a href="#编译配置选项" class="headerlink" title="编译配置选项"></a>编译配置选项</h3><blockquote>
<p>为了保留设置，Portage读入/etc/portage/make.conf文件 ，一个用于Portage的配置文件。<code>vi /mnt/gentoo/etc/portage/make.conf</code><br><img src="http://p7b7this6.bkt.clouddn.com/18-6-12/29231760.jpg" alt=""></p>
</blockquote>
<h2 id="安装Gentoo基本系统"><a href="#安装Gentoo基本系统" class="headerlink" title="安装Gentoo基本系统"></a>安装Gentoo基本系统</h2><h3 id="配置Chroot"><a href="#配置Chroot" class="headerlink" title="配置Chroot"></a>配置Chroot</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 选择一个Gentoo镜像站点，推荐163</span></span><br><span class="line">mirrorselect -i -o &gt;&gt; /mnt/gentoo/etc/portage/make.conf</span><br><span class="line"><span class="comment"># 构建ebuild配置文件</span></span><br><span class="line">mkdir /mnt/gentoo/etc/portage/repos.conf</span><br><span class="line">cp  /mnt/gentoo/usr/share/portage/config/repos.conf \</span><br><span class="line">    /mnt/gentoo/etc/portage/repos.conf/gentoo.conf</span><br><span class="line"></span><br><span class="line"><span class="comment"># 复制DNS信息（保证chroot后网络畅通）</span></span><br><span class="line">cp -L /etc/resolv.conf /mnt/gentoo/etc/</span><br><span class="line"></span><br><span class="line"><span class="comment"># 挂载必要文件系统（ /proc  /sys  /dev ）</span></span><br><span class="line"><span class="comment"># --make-rslave 操作是稍后安装systemd支持时所需要的。</span></span><br><span class="line">mount -t proc /proc /mnt/gentoo/proc</span><br><span class="line">mount --rbind /sys /mnt/gentoo/sys</span><br><span class="line">mount --make-rslave /mnt/gentoo/sys</span><br><span class="line">mount --rbind /dev /mnt/gentoo/dev</span><br><span class="line">mount --make-rslave /mnt/gentoo/dev</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment"># Chroot（进入新环境，所有操作均将立即生效）</span></span><br><span class="line">chroot /mnt/gentoo /bin/bash    </span><br><span class="line"><span class="built_in">source</span> /etc/profile             <span class="comment"># 将配置变量重新载入内存</span></span><br><span class="line"><span class="built_in">export</span> PS1=<span class="string">"(chroot) <span class="variable">$PS1</span>"</span>      <span class="comment"># 更改主提示符</span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment"># 挂载 /boot 分区</span></span><br><span class="line">mkdir /boot</span><br><span class="line">mount /dev/sda2 /boot</span><br></pre></td></tr></table></figure>
<h3 id="配置Poetage"><a href="#配置Poetage" class="headerlink" title="配置Poetage"></a>配置Poetage</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 从网站安装ebuild 数据库快照</span></span><br><span class="line">emerge-webrsync</span><br><span class="line"></span><br><span class="line"><span class="comment"># 更新Portage ebuild 数据库</span></span><br><span class="line">emerge --sync</span><br><span class="line"></span><br><span class="line"><span class="comment"># 选择正确的配置文件</span></span><br><span class="line">eselect profile list</span><br><span class="line">eselect profile <span class="built_in">set</span> NUMBER</span><br><span class="line"></span><br><span class="line"><span class="comment"># 更新@world集合</span></span><br><span class="line">emerge --ask --update --deep --newuse @world</span><br></pre></td></tr></table></figure>
<h3 id="配置时区和地区"><a href="#配置时区和地区" class="headerlink" title="配置时区和地区"></a>配置时区和地区</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 配置时区</span></span><br><span class="line"><span class="comment"># 查找可用的时区</span></span><br><span class="line">ls /usr/share/zoneinfo</span><br><span class="line"><span class="comment"># 设置时区为上海</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">"Asia/Shanghai"</span> &gt; /etc/timezone</span><br><span class="line"><span class="comment">#更新/etc/localtime</span></span><br><span class="line">emerge --config sys-libs/timezone-data</span><br><span class="line"></span><br><span class="line"><span class="comment"># 配置地区</span></span><br><span class="line"><span class="comment"># 启用US和CN地区及附加字符格式</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">'en_US ISO-8859-1</span></span><br><span class="line"><span class="string">en_US.UTF-8 UTF-8</span></span><br><span class="line"><span class="string">zh_CN GBK </span></span><br><span class="line"><span class="string">zh_CN.UTF-8 UTF-8</span></span><br><span class="line"><span class="string">'</span> &gt;&gt; /etc/locale.gen</span><br><span class="line"><span class="comment">#</span></span><br><span class="line">locale-gen</span><br><span class="line"><span class="comment"># 设定正确的地区</span></span><br><span class="line">eselect locale list</span><br><span class="line">eselect locale <span class="built_in">set</span> NUMBER</span><br><span class="line"></span><br><span class="line"><span class="comment"># 重新加载环境</span></span><br><span class="line">env-update &amp;&amp; <span class="built_in">source</span> /etc/profile &amp;&amp; <span class="built_in">export</span> PS1=<span class="string">"(chroot) <span class="variable">$PS1</span>"</span></span><br></pre></td></tr></table></figure>
<h2 id="配置Linux-Kernel"><a href="#配置Linux-Kernel" class="headerlink" title="配置Linux Kernel"></a>配置Linux Kernel</h2><h3 id="安装源码"><a href="#安装源码" class="headerlink" title="安装源码"></a>安装源码</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">emerge --ask sys-kernel/gentoo-sources</span><br><span class="line"></span><br><span class="line">ls -l /usr/src/linux</span><br></pre></td></tr></table></figure>
<h3 id="手动配置内核"><a href="#手动配置内核" class="headerlink" title="手动配置内核"></a>手动配置内核</h3><blockquote>
<p>详见<a href="https://wiki.gentoo.org/wiki/Kernel/Gentoo_Kernel_Configuration_Guide/zh-cn" target="_blank" rel="noopener">Kernel/Gentoo 内核配置指南</a><br><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> /usr/src/linux</span><br><span class="line"><span class="comment"># 配置Kernel</span></span><br><span class="line">make menuconfig</span><br><span class="line"></span><br><span class="line"><span class="comment"># 编译Kernel</span></span><br><span class="line">make &amp;&amp; make modules_install</span><br><span class="line"><span class="comment"># 安装Kernel</span></span><br><span class="line">make install</span><br></pre></td></tr></table></figure></p>
</blockquote>
<h2 id="配置新系统"><a href="#配置新系统" class="headerlink" title="配置新系统"></a>配置新系统</h2><h3 id="硬盘分区开机自动挂载"><a href="#硬盘分区开机自动挂载" class="headerlink" title="硬盘分区开机自动挂载"></a>硬盘分区开机自动挂载</h3><p><img src="http://p7b7this6.bkt.clouddn.com/18-6-2/34674673.jpg" alt=""></p>
<h3 id="配置root密码"><a href="#配置root密码" class="headerlink" title="配置root密码"></a>配置root密码</h3><p><code>passwd root</code></p>
<h2 id="安装系统工具"><a href="#安装系统工具" class="headerlink" title="安装系统工具"></a>安装系统工具</h2><h3 id="VIM"><a href="#VIM" class="headerlink" title="VIM"></a>VIM</h3><p><code>emerge --ask vim</code></p>
<h3 id="无线网络驱动"><a href="#无线网络驱动" class="headerlink" title="无线网络驱动"></a>无线网络驱动</h3><p><code>emerge sys-kernel/linux-firmware</code></p>
<h3 id="安装wpa-supplicant"><a href="#安装wpa-supplicant" class="headerlink" title="安装wpa_supplicant"></a>安装wpa_supplicant</h3><p><code>emerge wpa_supplicant</code></p>
<h3 id="安装DHCP客户端"><a href="#安装DHCP客户端" class="headerlink" title="安装DHCP客户端"></a>安装DHCP客户端</h3><p><code>emerge dhcpcd</code></p>
<h3 id="安装PPPoE客户端"><a href="#安装PPPoE客户端" class="headerlink" title="安装PPPoE客户端"></a>安装PPPoE客户端</h3><p><code>emerge --ask net-dialup/ppp</code></p>
<h3 id="日志工具"><a href="#日志工具" class="headerlink" title="日志工具"></a>日志工具</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">emerge syslog-ng</span><br><span class="line">rc-update add syslog-ng default</span><br></pre></td></tr></table></figure>
<h3 id="Cron守护进程"><a href="#Cron守护进程" class="headerlink" title="Cron守护进程"></a>Cron守护进程</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">emerge --ask sys-process/cronie</span><br><span class="line">rc-update add cronie default</span><br><span class="line">crontab /etc/crontab</span><br></pre></td></tr></table></figure>
<h2 id="配置BootLoader"><a href="#配置BootLoader" class="headerlink" title="配置BootLoader"></a>配置BootLoader</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">echo</span> <span class="string">'GRUB_PLATFORMS="efi-64"'</span> &gt;&gt; /etc/portage/make.conf</span><br><span class="line">emerge --ask sys-boot/grub:2</span><br><span class="line"></span><br><span class="line">grub-install --target=x86_64-efi --efi-directory=/boot</span><br><span class="line"></span><br><span class="line">grub-mkconfig -o /boot/grub/grub.cfg</span><br><span class="line"></span><br><span class="line">reboot</span><br></pre></td></tr></table></figure>

      
    </div>

    

    
    
    

    

    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/Linux/" rel="tag"># Linux</a>
          
            <a href="/tags/Gentoo/" rel="tag"># Gentoo</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/origin_1/" rel="next" title="Origin打开文件时出现错误的解决办法">
                <i class="fa fa-chevron-left"></i> Origin打开文件时出现错误的解决办法
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image"
                src="http://p7b7this6.bkt.clouddn.com/18-6-3/47273717.jpg"
                alt="LiuGaoyong" />
            
              <p class="site-author-name" itemprop="name">LiuGaoyong</p>
              <p class="site-description motion-element" itemprop="description"></p>
          </div>

          
            <nav class="site-state motion-element">
              
                <div class="site-state-item site-state-posts">
                
                  <a href="/archives/">
                
                    <span class="site-state-item-count">22</span>
                    <span class="site-state-item-name">日志</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-categories">
                  <a href="/categories/index.html">
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">15</span>
                    <span class="site-state-item-name">分类</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-tags">
                  <a href="/tags/index.html">
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">26</span>
                    <span class="site-state-item-name">标签</span>
                  </a>
                </div>
              
            </nav>
          

          

          
            <div class="links-of-author motion-element">
              
                <span class="links-of-author-item">
                  <a href="https://github.com/LiuGaoyong" target="_blank" title="GitHub"><i class="fa fa-fw fa-github"></i>GitHub</a>
                  
                </span>
              
                <span class="links-of-author-item">
                  <a href="http://weibo.com/LiuGaoyongYoung" target="_blank" title="Weibo"><i class="fa fa-fw fa-weibo"></i>Weibo</a>
                  
                </span>
              
                <span class="links-of-author-item">
                  <a href="https://twitter.com/liugaoyong" target="_blank" title="Twitter"><i class="fa fa-fw fa-twitter"></i>Twitter</a>
                  
                </span>
              
                <span class="links-of-author-item">
                  <a href="https://www.facebook.com/liugaoyong" target="_blank" title="FaceBook"><i class="fa fa-fw fa-facebook"></i>FaceBook</a>
                  
                </span>
              
            </div>
          

          
          

          
          
            <div class="links-of-blogroll motion-element links-of-blogroll-block">
              <div class="links-of-blogroll-title">
                <i class="fa  fa-fw fa-link"></i>
                Links
              </div>
              <ul class="links-of-blogroll-list">
                
                  <li class="links-of-blogroll-item">
                    <a href="https://www.github.com" title="Github 官网" target="_blank">Github 官网</a>
                  </li>
                
              </ul>
            </div>
          

          
            
          
          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#准备工作环境"><span class="nav-number">1.</span> <span class="nav-text">准备工作环境</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#Linux系统"><span class="nav-number">1.1.</span> <span class="nav-text">Linux系统</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#开通网络服务"><span class="nav-number">1.2.</span> <span class="nav-text">开通网络服务</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#sshd服务"><span class="nav-number">1.3.</span> <span class="nav-text">sshd服务</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#对安装Gentoo的磁盘进行处理"><span class="nav-number">2.</span> <span class="nav-text">对安装Gentoo的磁盘进行处理</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#默认的分区方案"><span class="nav-number">2.1.</span> <span class="nav-text">默认的分区方案</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#创建分区表"><span class="nav-number">2.2.</span> <span class="nav-text">创建分区表</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#创建文件系统"><span class="nav-number">2.3.</span> <span class="nav-text">创建文件系统</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#激活swap分区"><span class="nav-number">2.4.</span> <span class="nav-text">激活swap分区</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#挂载分区"><span class="nav-number">2.5.</span> <span class="nav-text">挂载分区</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#安装Gentoo安装文件（stage3）"><span class="nav-number">3.</span> <span class="nav-text">安装Gentoo安装文件（stage3）</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#下载stage3"><span class="nav-number">3.1.</span> <span class="nav-text">下载stage3</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#校验其安全性（可省略），解压stage3"><span class="nav-number">3.2.</span> <span class="nav-text">校验其安全性（可省略），解压stage3</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#编译配置选项"><span class="nav-number">3.3.</span> <span class="nav-text">编译配置选项</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#安装Gentoo基本系统"><span class="nav-number">4.</span> <span class="nav-text">安装Gentoo基本系统</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#配置Chroot"><span class="nav-number">4.1.</span> <span class="nav-text">配置Chroot</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#配置Poetage"><span class="nav-number">4.2.</span> <span class="nav-text">配置Poetage</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#配置时区和地区"><span class="nav-number">4.3.</span> <span class="nav-text">配置时区和地区</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#配置Linux-Kernel"><span class="nav-number">5.</span> <span class="nav-text">配置Linux Kernel</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#安装源码"><span class="nav-number">5.1.</span> <span class="nav-text">安装源码</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#手动配置内核"><span class="nav-number">5.2.</span> <span class="nav-text">手动配置内核</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#配置新系统"><span class="nav-number">6.</span> <span class="nav-text">配置新系统</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#硬盘分区开机自动挂载"><span class="nav-number">6.1.</span> <span class="nav-text">硬盘分区开机自动挂载</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#配置root密码"><span class="nav-number">6.2.</span> <span class="nav-text">配置root密码</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#安装系统工具"><span class="nav-number">7.</span> <span class="nav-text">安装系统工具</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#VIM"><span class="nav-number">7.1.</span> <span class="nav-text">VIM</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#无线网络驱动"><span class="nav-number">7.2.</span> <span class="nav-text">无线网络驱动</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#安装wpa-supplicant"><span class="nav-number">7.3.</span> <span class="nav-text">安装wpa_supplicant</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#安装DHCP客户端"><span class="nav-number">7.4.</span> <span class="nav-text">安装DHCP客户端</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#安装PPPoE客户端"><span class="nav-number">7.5.</span> <span class="nav-text">安装PPPoE客户端</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#日志工具"><span class="nav-number">7.6.</span> <span class="nav-text">日志工具</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Cron守护进程"><span class="nav-number">7.7.</span> <span class="nav-text">Cron守护进程</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#配置BootLoader"><span class="nav-number">8.</span> <span class="nav-text">配置BootLoader</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2018</span>
  <span class="with-love" id="animate">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">LiuGaoyong</span>

  

  
</div>




  <div class="powered-by">由 <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> 强力驱动 v3.7.1</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 &mdash; <a class="theme-link" target="_blank" href="https://github.com/theme-next/hexo-theme-next">NexT.Gemini</a> v6.1.0</div>




        








        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>


























  
  
    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=6.1.0"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=6.1.0"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=6.1.0"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=6.1.0"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=6.1.0"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=6.1.0"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=6.1.0"></script>



  



	





  





  










  





  

  

  

  

  
  

  

  

  

  

</body>
</html>
